export const ADD_TODO = 'ADD_TODO';
export const COMPLETED_TODO = 'COMPLETED_TODO';
export const REMOVE_TODO = 'REMOVE_TODO';
export const TOGGLE_ALL_TODO = 'TOGGLE_ALL_TODO';
export const SET_VISIBILITY_FILTER = 'SET_VISIBILITY_FILTER';

export const VisibilityFilters = {
    SHOW_ALL: 'SHOW_ALL',
    SHOW_COMPLETED: 'SHOW_COMPLETED',
    SHOW_ACTIVE: 'SHOW_ACTIVE'
}

export function addTodo(text) {
    return {
        type: ADD_TODO,
        text
    }
}

export function completedTodo(todoId) {
    return {
        type: COMPLETED_TODO,
        todoId
    }
}

export function removeTodo(todoId) {
    return {
        type: REMOVE_TODO,
        todoId
    }
}

export function toggleAllTodo(completed) {
    return {
        type: TOGGLE_ALL_TODO,
        completed
    }
}

export function setVisibilityFilter(filter) {
    return {
        type: SET_VISIBILITY_FILTER,
        filter
    }
}